# Maintainer: fauxpark <fauxpark@gmail.com>

_realname=dfu-programmer
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=0.7.2
pkgrel=2
pkgdesc='Device firmware update based USB programmer for Atmel chips (mingw-w64)'
arch=('any')
license=('GPL')
url='https://github.com/dfu-programmer/dfu-programmer'
depends=("${MINGW_PACKAGE_PREFIX}-libusb-win32")
source=(
    "https://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/${pkgver}/dfu-programmer-${pkgver}.tar.gz"
    01-use-libusb-win32.patch
)
sha256sums=(
    '1db4d36b1aedab2adc976e8faa5495df3cf82dc4bf883633dc6ba71f7c4af995'
    '7c8d27dbc8b24aefa54514594711301852741021623b25af136271d767a0fdc8'
)

prepare() {
    cd ${srcdir}/${_realname}-${pkgver}

    patch -p1 -i ../01-use-libusb-win32.patch
}

build() {
    cd ${srcdir}/${_realname}-${pkgver}

    ./bootstrap.sh
    ./configure \
        --prefix=${MINGW_PREFIX} \
        --disable-libusb_1_0
}

package() {
    cd ${srcdir}/${_realname}-${pkgver}

    make DESTDIR="$pkgdir" install
}
